﻿using System.Collections.Generic;
using System.Text;

namespace Jodell.Lua
{
    public class LineSegment
    {
        public double K { get; set; }
        public double B { get; set; }

        public double MinValue { get; set; }
        public double MaxValue { get; set; }

        public List<double> XDatas { get; private set; } = new List<double>();
        public List<double> YDatas { get; private set; } = new List<double>();

        private bool isChecked;

        public bool IsChecked
        {
            get { return isChecked; }
            set { isChecked = value; }
        }


        public string Expression
        {
            get
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendFormat("y ={0:N2}*x", K);
                if (B >= 0)
                {
                    sb.Append("+");
                }
                sb.Append(B.ToString("N2"));
                return sb.ToString();
            }
        }
        public string Scope
        {
            get
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("[");
                sb.Append(MinValue.ToString("N2"));
                sb.Append(" , ");
                sb.Append(MaxValue.ToString("N2"));
                sb.Append("]");
                return sb.ToString();
            }
        }
    }


    public class PointData
    {
        public double X { get; set; }
        public double Y { get; set; }
    }
}
